<!-- 待审批用户申请页面 -->

<template>
	<view>
		<uni-section title="待审批申请列表" type="line" padding>
			<!-- 用户注册 -->
			<view class="uni-padding-wrap uni-common-mt">
				<view class="order-list" v-for="(item, index) in user_ini_list" :key="index" >
					<uni-card title="用户注册申请" :sub-title="item.uname" :extra="item.ujob" :thumbnail="order_picture" @click="enterUserRequest(item)">
					</uni-card>
				</view>
			</view>
			<!-- 用户修改信息 -->
			<view class="uni-padding-wrap uni-common-mt">
				<view class="order-list" v-for="(item, index) in user_mod_list" :key="index" >
					<uni-card title="用户信息修改申请" :sub-title="item.old.uname" :extra="item.old.ujob" :thumbnail="order_picture" @click="enterUserRequest(item)">
					</uni-card>
				</view>
			</view>
		</uni-section>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				order_picture: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
				user_mod_list: [
					{
						type: 1,
						old: {
							uid: 1,
							uname: '梅西',
							ujob: 'Student',
							uphone: '18923042418',
							upassword: '123456789',
							ulevel: 1
						},
						new: {
							uid: 1,
							uname: '里奥·梅西',
							ujob: '',
							uphone: '',
							upassword: '',
							ulevel: 1
						}
					},
					{
						type: 1,
						old: {
							uid: 1,
							uname: '拉莫斯',
							ujob: 'Student',
							uphone: '18923042418',
							upassword: '123456789',
							ulevel: 1
						},
						new: {
							uid: 1,
							uname: '',
							ujob: 'Repairer',
							uphone: '',
							upassword: '',
							ulevel: 1
						}
					},
					{
						type: 1,
						old: {
							uid: 1,
							uname: '梅西',
							ujob: 'Student',
							uphone: '18923042418',
							upassword: '123456789',
							ulevel: 1
						},
						new: {
							uid: 1,
							uname: 'C罗',
							ujob: '',
							uphone: '',
							upassword: '88888888',
							ulevel: 2
						}
					}
				],
				user_ini_list: [
					{
						type: 0,
						uid: 1,
						uname: '梅西',
						ujob: 'Student',
						uphone: '18923042418',
						upassword: '123456789',
						ulevel: 1
					},
					{
						type: 0,
						uid: 2,
						uname: '老王',
						ujob: 'Repairer',
						uphone: '18923042418',
						upassword: '123456789',
						ulevel: 2
					},
					{
						type: 0,
						uid: 3,
						uname: 'C罗',
						ujob: 'Student',
						uphone: '18923042418',
						upassword: '123456789',
						ulevel: 1
					},
					{
						type: 0,
						uid: 4,
						uname: '莱万',
						ujob: 'Student',
						uphone: '18923042418',
						upassword: '123456789',
						ulevel: 1
					}
				],
				userType: ['管理员', '维修人员', '普通用户']
			}
		},
		methods: {
			enterUserRequest(user) {
				console.log("跳转到用户申请页")
				uni.navigateTo({
					url: "../user/user_request?user=" + JSON.stringify(user)
				});
			},
			getMessage() {
				//用户注册申请
				uni.request({
				    url: 'http://localhost:8081/user/check_register',
					success: (res) => {
						console.log(res.data.data);
						if (res.data.code == "200") {
							this.user_ini_list = res.data.data;
						}
					}
				});
				
				//用户信息修改
				uni.request({
				    url: 'http://localhost:8081/user/check_mod',
					success: (res) => {
						console.log(res.data.data);
						if (res.data.code == "200") {
							this.user_mod_list = res.data.data;
						}
					}
				});
			}
		},
		onLoad(options) {
			this.getMessage()
		}
	}
</script>

<style>
	.uni-padding-wrap {
		width: 710rpx;
		padding: 0px 0px;
	}
	.uni-common-mt {
		margin-top: 0px;
	}
</style>